﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace PocketPatients
{
    public partial class PocketPatientsForm : Form
    {
        public PocketPatientsForm()
        {
            InitializeComponent();

            twoLineListBox1.DataSource = SharedData.Patients;
            twoLineListBox1.Line1DisplayMember = "FullName";
            twoLineListBox1.Line2DisplayMember = "Age";
        }

        private void PocketPatientsForm_Load(object sender, EventArgs e)
        {
        }

        private void PocketPatientsForm_Closed(object sender, EventArgs e)
        {
        }

        private void twoLineListBox1_Click(object sender, EventArgs e)
        {
            PatientViewForm.Instance.ShowDialog();
        }

        private void menuItem1_Click(object sender, EventArgs e)
        {
            int oldpos = SharedData.Patients.Position;
            SharedData.Patients.Position = SharedData.Patients.Add(new Patient());
            PatientEditForm.Instance.ShowDialog();
            if (((Patient)SharedData.Patients.Current).LastName == "")
            {
                SharedData.Patients.RemoveCurrent();
                SharedData.Patients.Position = oldpos;
            }
        }
    }
}